﻿@*{
        ViewBag.Title = "EventDetial";
        Layout = "~/Areas/IM/Views/Shared/_Layout.cshtml";
    }
    @section Scripts{
        <script type="text/javascript">


        $(document).ready(function () {
            BindCombobox();
            getEventInfo();
            //getTaskGreenDateInfo();
        });

        //获取事件信息
        function getEventInfo() {
            $.ajax({
                type: 'POST',
                url: '@Url.Content("~/DD/AcceptEvent/GetAlarmEventInfo")',
                data:
                    {
                        eventCode: $("#ACID").val(),
                        //AcceptOrder: $("#ACOrderID").val()
                    },
                dataType: "json",
                success: function (jsData) {
                    $('#EventCode').html(jsData.PLInfo.EventCode);
                    if (jsData.PLInfo.IsFinish == true) { $('#IsFinish').html("是"); }
                    else { $('#IsFinish').html("否"); }
                    if (jsData.PLInfo.IsPlaceOrder == true) { $('#IsPlaceOrder').html("是"); }
                    else { $('#IsPlaceOrder').html("否"); }
                    $('#EventType').html(jsData.PLInfo.EventType);
                    $('#EventSource').html(jsData.PLInfo.EventSource);
                    $('#CenterName').html(jsData.PLInfo.CenterName);
                    $('#EvetnName').html(jsData.PLInfo.EvetnName);
                    $('#FirstAlarmCall').html(jsData.PLInfo.FirstAlarmCall);
                    if (jsData.PLInfo.IsTest == true) { $('#IsTest').html("是"); }
                    else { $('#IsTest').html("否"); }
                    var fFirstAcceptTime = $.formatTime(jsData.PLInfo.FirstAcceptTime);
                    $('#FirstAcceptTime').html(fFirstAcceptTime);
                    $('#FirstDisptcherName').html(jsData.PLInfo.FirstDisptcherName);
                    $('#AcceptCount').html(jsData.PLInfo.AcceptCount);
                    $('#FirstSendAmbTime').html($.formatTime(jsData.PLInfo.FirstSendAmbTime));
                    $('#IllState').html(jsData.PLInfo.IllStateName);
                    $('#TieUpDeskCode').html(jsData.PLInfo.TieUpDeskCode);
                    $('#CancelAcceptCount').html(jsData.PLInfo.CancelAcceptCount);
                    $('#TransactTaskCount').html(jsData.PLInfo.TransactTaskCount);
                    $('#BreakTaskCount').html(jsData.PLInfo.BreakTaskCount);

                    if (jsData.PLInfo.IsHangUp == true) { $('#IsHangUp').html("是"); }
                    else { $('#IsHangUp').html("否"); }
                    $('#HangUpTime').html($.formatTime(jsData.PLInfo.HangUpTime));
                    $('#BespeakTime').html($.formatTime(jsData.PLInfo.BespeakTime));
                    if (jsData.PLInfo.IsLabel == true) { $('#IsLabel').html("是"); }
                    else { $('#IsLabel').html("否"); }
                    $('#XYPosition').html(jsData.PLInfo.X + ',' + jsData.PLInfo.Y);
                    $('#Area').html(jsData.PLInfo.Area);

                    $('#NonceTransactTaskCount').html(jsData.PLInfo.NonceTransactTaskCount);
                    $('#AccidentType').html(jsData.PLInfo.AccidentType);
                    $('#AccidentLevel').html(jsData.PLInfo.AccidentLevel);

                    //修改 zzm
                    if ('@ViewData["RolePermissionInsert"]' == "Insert") {
                        $('#TaskEdit').show();

                        $('#EEventSource').combobox('setValue', jsData.PLInfo.EventSource);
                        $('#EEventType').combobox('setValue', jsData.PLInfo.EventType);
                        $('#EEvetnName').textbox('setValue', jsData.PLInfo.EvetnName);
                        $('#ECenterName').combobox('setValue', jsData.PLInfo.CenterName);
                        $('#EFirstAlarmCall').textbox('setValue', jsData.PLInfo.FirstAlarmCall);
                        $('#EArea').combobox('setValue', jsData.PLInfo.Area);
                        $('#EAccidentType').combobox('setValue', jsData.PLInfo.AccidentType);
                        $('#EAccidentLevel').combobox('setValue', jsData.PLInfo.AccidentLevel);

                        $('#LFirstDisptcherName').html(jsData.PLInfo.FirstDisptcherName);
                        $('#HFirstDisptcherNameCodes').val(jsData.PLInfo.FirstDisptcherNameCodes);
                        $('#HFirstDisptcherNameNames').val(jsData.PLInfo.FirstDisptcherName);

                        $('#EFirstAcceptTime').datetimebox('setValue', jsData.PLInfo.FirstAcceptTime);
                        $('#EFirstSendAmbTime').datetimebox('setValue', jsData.PLInfo.FirstSendAmbTime);
                        $('#ENonceTransactTaskCount').textbox('setValue', jsData.PLInfo.NonceTransactTaskCount);

                        $('#HEventID').val(jsData.PLInfo.EventCode);
                        $('#HEventType').val(jsData.PLInfo.EventType);
                        $('#HEventSource').val(jsData.PLInfo.EventSource);
                        $('#HCenterName').val(jsData.PLInfo.CenterName);
                        $('#HArea').val(jsData.PLInfo.Area);
                        $('#HAccidentType').val(jsData.PLInfo.AccidentType);
                        $('#HAccidentLevel').val(jsData.PLInfo.AccidentLevel);
                    }
                    else { $('#TaskEdit').hide(); }
                }
            });
        }
            function BindCombobox() {
            //事件类型
            $("#EEventType").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetAlarmEventType")',
                valueField: 'id',
                textField: 'text',
                editable: false,
                OneOption: [{
                    id: "-1",
                    text: "--请选择--"
                }]
            });
            //事件来源
            $("#EEventSource").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetEventnName")',
                valueField: 'id',
                textField: 'text',
                editable: false,
                OneOption: [{
                    id: "-1",
                    text: "--请选择--"
                }]
            });
            //受理中心
            $("#ECenterName").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetCenter")',
                valueField: 'id',
                textField: 'text',
                editable: false,
                OneOption: [{
                    id: "-1",
                    text: "--请选择--"
                }]
            });
            //区域
            $("#EArea").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetArea")',
                valueField: 'id',
                textField: 'text',
                editable: false,
                OneOption: [{
                    id: "-1",
                    text: "--请选择--"
                }]
            });
            //事故类型
            $("#EAccidentType").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetAccidentType")',
                valueField: 'id',
                textField: 'text',
                editable: false,
                OneOption: [{
                    id: "-1",
                    text: "--请选择--"
                }]
            });
            //事故等级
            $("#EAccidentLevel").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetAccidentLevel")',
                valueField: 'id',
                textField: 'text',
                editable: false,
                OneOption: [{
                    id: "-1",
                    text: "--请选择--"
                }]
            });
            //首次受理调度
            $("#EFirstDisptcherName").combobox({
                url: '@Url.Content("~/BB/AllDictionary/GetPersonForType?RoleID=2")',
                valueField: 'ID',
                textField: 'Name',
                editable: false,
                OneOption: [{
                    ID: "",
                    Name: "--请选择--"
                }]
            });
            }
            //修改 zzm
    </script>

        <script type="text/javascript">
            //删除首次受理调度
            function DelFirstDisptcherName() {
                var oFirstDisptcherName = $('#LFirstDisptcherName').text();
                var oFirstDisptcherNameCodes = $('#HFirstDisptcherNameCodes').val();
                if (oFirstDisptcherName.length > 0) {
                    var nFirstDisptcherName = oFirstDisptcherName.substring(0, oFirstDisptcherName.lastIndexOf(","));
                    var nFirstDisptcherNameCodes = oFirstDisptcherNameCodes.substring(0, oFirstDisptcherNameCodes.lastIndexOf("|"));
                    $('#LFirstDisptcherName').html(nFirstDisptcherName);
                    $('#HFirstDisptcherNameNames').val(nFirstDisptcherName);
                    $('#HFirstDisptcherNameCodes').val(nFirstDisptcherNameCodes);
                }
            }
            //添加首次受理调度------------------------------------------------------------------------------
            function AddFirstDisptcherName() {
                var oFirstDisptcherName = $('#LFirstDisptcherName').text();
                var oFirstDisptcherNameCodes = $('#HFirstDisptcherNameCodes').val();
                if (oFirstDisptcherName.length > 0) {
                    //已经存在
                    if (oFirstDisptcherNameCodes.indexOf($('#EDriver').combobox('getValue')) >= 0)
                    { }
                    else
                    {
                        $('#LFirstDisptcherName').html(oFirstDisptcherName + "," + $('#EFirstDisptcherName').combobox('getText'));
                        $('#HFirstDisptcherNameCodes').val(oFirstDisptcherNameCodes + "|" + $('#EFirstDisptcherName').combobox('getValue'));
                    }
                }
                else {
                    $('#LFirstDisptcherName').html($('#EFirstDisptcherName').combobox('getText'));
                    $('#HFirstDisptcherNameCodes').val($('#EFirstDisptcherName').combobox('getValue'));
                }
                $('#HFirstDisptcherNameNames').val($('#LFirstDisptcherName').text());
            }
        </script>
        <script type="text/javascript">
            function SaveTaskInfo() {
                $('#ff').form('submit', {
                    onSubmit: function () {
                        $('#HEventTypeID').val($('#EEventType').combobox('getValue'));
                        $('#HEventSourceID').val($('#EEventSource').combobox('getValue'));
                        $('#HCenterName').val($('#ECenterName').combobox('getValue'));
                        $('#HArea').val($('#EArea').combobox('getValue'));
                        return $(this).form('validate');
                    },
                    success: function (msg) {
                        var data = eval('(' + msg + ')');
                        if (data.IsSuccess) {
                            $.messager.alert('提示', data.Message, 'info', function () {
                                location.reload();
                                closeDialog();
                            });
                        }
                        else {
                            $.messager.alert('提示', data.Message, 'info', function () {
                            });
                        }
                    }
                });
            }
            function closeDialogLookCrack() {
                $('#LookCrack').window('close');
            }
            //显示修改痕迹
            function ViewModify() {
                $('#CrackList').datagrid({
                    title: '修改记录列表',
                    width: '99%',
                    height: 460,
                    nowrap: true,
                    autoRowHeight: true,
                    striped: true,
                    collapsible: true,
                    url: '@Url.Content("~/Task/GetCrackInfos?EventCode=")' + '@ViewBag.eventCode',
                    //sortName: 'ChanShengShiKe',
                    //sortOrder: 'desc',
                    remoteSort: false,
                    singleSelect: true,
                    frozenColumns: [[
                        { title: '修改时间', field: 'StringOperateTime', width: 120, sortable: true },
                        { title: '修改人', field: 'OperatorName', width: 70, sortable: false },
                        { title: '修改项目', field: 'TypeName', width: 80, sortable: false },
                        { title: '修改前内容', field: 'OriginContent', width: 160, sortable: false },
                        { title: '修改后内容', field: 'NewContent', width: 160, sortable: false },
                        { title: '任务编码', field: 'EventCode', width: 180, sortable: false }
                    ]],
                    pagination: true,//启用分页，默认每页10行
                    rownumbers: true,//显示页码，默认 提供 10 - 50 的页容量选择下拉框
                    pageNumber: 1,
                    pageSize: 15,//设置 页容量5为
                    pageList: [10, 15, 20]//设置 页容量下拉框

                });
                var p = $('#CrackList').datagrid('getPager');
                $(p).pagination({
                    onBeforeRefresh: function () {
                    }
                });
                $('#LookCrack').window('open');
            }
        </script>
    }
    <div id="divIndex" class="easyui-layout" style="width:auto; height: auto; margin-left: auto; margin-right: auto">
        <input name="txtAC" type="hidden" id="ACID" value="@ViewBag.eventCode" />
        <div style="width: 99%; height: 99%;">
            <div style="width: 99%; height: 230px;">
                <table border="0" cellpadding="0" cellspacing="0" style="width: 99%; text-align: left; margin-left: 0px; margin-right: 0px; margin-top: 5px; font-size:small">
                    <tr style="height: 28px; ">
                        <td style="width: 10%" align="right">
                            事件编码：
                        </td>
                        <td>
                            <span id="EventCode" style="width:150px;"></span>
                        </td>
                        <td style="width: 10%" align="right">
                            表单完成标志：
                        </td>
                        <td>
                            <span id="IsFinish" style="width:150px;"></span>
                        </td>
                        <td style="width: 10%" align="right">
                            是否落单：
                        </td>
                        <td>
                            <span id="IsPlaceOrder" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">事件类型：</td>
                        <td>
                            <span id="EventType" style="width: 200px; color: blue;"></span>
                        </td>
                        <td align="right">
                            事件名称：
                        </td>
                        <td>
                            <span id="EvetnName" style="width:150px;"></span>
                        </td>
                        <td align="right">受理中心：</td>
                        <td>
                            <span id="CenterName" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">事件来源：</td>
                        <td>
                            <span id="EventSource" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            首次呼救电话：
                        </td>
                        <td>
                            <span id="FirstAlarmCall" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            是否测试：
                        </td>
                        <td>
                            <span id="IsTest" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            首次受理时刻：
                        </td>
                        <td>
                            <span id="FirstAcceptTime" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            首次受理调度：
                        </td>
                        <td>
                            <span id="FirstDisptcherName" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            受理次数：
                        </td>
                        <td>
                            <span id="AcceptCount" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            首次派车时刻：
                        </td>
                        <td>
                            <span id="FirstSendAmbTime" style="width:150px;"></span>
                        </td>

                        <td align="right">
                            执行任务总数：
                        </td>
                        <td>
                            <span id="TransactTaskCount" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            撤销受理数：
                        </td>
                        <td>
                            <span id="CancelAcceptCount" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            占用台号：
                        </td>
                        <td>
                            <span id="TieUpDeskCode" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            中止任务数：
                        </td>
                        <td>
                            <span id="BreakTaskCount" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            病&nbsp;情：
                        </td>
                        <td>
                            <span id="IllState" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            是否挂起：
                        </td>
                        <td>
                            <span id="IsHangUp" style="width:150px;"></span>
                        </td>
                        <td align="right">当前执行任务数：</td>
                        <td>
                            <span id="NonceTransactTaskCount" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            区&nbsp;域：
                        </td>
                        <td>
                            <span id="Area" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            挂起时刻：
                        </td>
                        <td>
                            <span id="HangUpTime" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            X，Y坐标：
                        </td>
                        <td>
                            <span id="XYPosition" style="width:150px;"></span>
                        </td>
                        <td align="right">
                            是否标注：
                        </td>
                        <td>
                            <span id="IsLabel" style="width:150px;"></span>
                        </td>
                    </tr>
                    <tr style="height:28px;">
                        <td align="right">
                            预约时刻：
                        </td>
                        <td>
                            <span id="BespeakTime" style="width:150px;"></span>
                        </td>
                        <td align="right">事故类型：</td>
                        <td>
                            <span id="AccidentType" style="width:150px;"></span>
                        </td>
                        <td align="right">事故等级：</td>
                        <td>
                            <span id="AccidentLevel" style="width:150px;"></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="easyui-panel" title="电话信息" style="width:99%;height:240px;">
                <table border="1" id="telRecord" style="margin-top: 5px"></table>
            </div>
            <div id="TaskEdit">
                <div class="easyui-panel" title="修改信息" style="width:100%;height:240px;">
                    <form id="ff" method="post" action="~/Task/UpdateTask/" enctype="multipart/form-data">
                        <table border="0" style=" width: 99%; margin-top: 5px; font-size: small">
                            <tr style="height: 22px; ">
                                <td align="right">
                                    事件名称：
                                </td>
                                <td>
                                    <input id="EEvetnName" name="EvetnName" class="easyui-textbox" style="width:150px" />
                                </td>
                                <td align="right" width="10%">
                                    事件类型：
                                </td>
                                <td width="15%">
                                    <select id="EEventType" class="easyui-combobox" style="width:150px"></select>
                                    <input type="hidden" id="HEventType" name="EventType" />
                                </td>
                                <td align="right" width="10%">
                                    事件来源：
                                </td>
                                <td width="15%">
                                    <select id="EEventSource" class="easyui-combobox" style="width:150px"></select>
                                    <input type="hidden" id="HEventSource" name="EventSource" />
                                </td>
                                <td align="right" width="10%">
                                    受理中心：
                                </td>
                                <td width="15%">
                                    <select id="ECenterName" class="easyui-combobox" style="width:150px"></select>
                                    <input type="hidden" id="HCenterName" name="CenterName" />
                                </td>
                            </tr>
                            <tr style="height: 22px; ">
                                <td align="right" width="10%">
                                    首次呼救电话：
                                </td>
                                <td>
                                    <input id="EFirstAlarmCall" name="FirstAlarmCall" class="easyui-textbox" style="width:150px" />
                                </td>
                                <td align="right" width="10%">
                                    区域：
                                </td>
                                <td width="15%">
                                    <select id="EArea" class="easyui-combobox" style="width:150px"></select>
                                    <input type="hidden" id="HArea" name="Area" />
                                </td>
                                <td align="right" width="10%">
                                    事故类型：
                                </td>
                                <td width="15%">
                                    <select id="EAccidentType" class="easyui-combobox" style="width:150px"></select>
                                    <input type="hidden" id="HAccidentType" name="AccidentType" />
                                </td>
                                <td align="right" width="10%">
                                    事故等级：
                                </td>
                                <td width="15%">
                                    <select id="EAccidentLevel" class="easyui-combobox" style="width:150px"></select>
                                    <input type="hidden" id="HAccidentLevel" name="AccidentLevel" />
                                </td>
                            </tr>
                            <tr style="height: 22px; ">
                                <td align="right">
                                    首次受理调度：
                                </td>
                                <td align="left">
                                    <span id="LFirstDisptcherName" style="width:150px;"></span>
                                    <input type="hidden" id="HFirstDisptcherNameNames" name="FirstDisptcherName" />
                                    <input type="hidden" id="HFirstDisptcherNameCodes" name="FirstDisptcherNameCodes" />
                                    <a id="DelFirstDisptcherName" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" href="javascript:void(0)" onclick="DelDriver()">删除</a>
                                </td>
                                <td align="left" colspan="2">
                                    <select id="EFirstDisptcherName" class="easyui-combobox" style="width:150px"></select>
                                    <a id="AddFirstDisptcherName" class="easyui-linkbutton" data-options="iconCls:'icon-add'" href="javascript:void(0)" onclick="AddDriver()">添加</a>
                                </td>
                            </tr>
                            <tr style="height: 22px; ">
                                <td align="right" width="10%">
                                    首次受理时刻：
                                </td>
                                <td align="left">
                                    <input id="EFirstAcceptTime" name="FirstAcceptTime" class="easyui-datetimebox" style="width:150px" data-options="editable:true" />
                                </td>
                                <td align="right" width="10%">
                                    首次派车时刻：
                                </td>
                                <td align="left">
                                    <input id="EFirstSendAmbTime" name="FirstSendAmbTime" class="easyui-datetimebox" style="width:150px" data-options="editable:true" />
                                </td>
                                <td align="right" width="10%">
                                    当前执行任务数：
                                </td>
                                <td>
                                    <input id="ENonceTransactTaskCount" name="NonceTransactTaskCount" class="easyui-textbox" style="width:150px" />
                                </td>

                                <td align="right" colspan="2">
                                    <a id="Save" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="SaveTaskInfo()">保存修改</a>
                                    <a id="View" class="easyui-linkbutton" data-options="iconCls:'icon-search'" href="javascript:void(0)" onclick="ViewModify()">查看修改</a>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div id="LookCrack" class="easyui-window" data-options="title:'修改记录',iconCls:'icon-save',closed:true,modal:true,collapsible: false,maximizable: false" style="width: 850px; height: 550px; padding: 5px;">
        <div class="easyui-layout" data-options="fit:true">
            <div data-options="region:'center',border:false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
                <div data-options="region:'center'" style="background: #fafafa; overflow: hidden">
                    <table id="CrackList" class="easyui-datagrid"></table>
                </div>
            </div>
            <div data-options="region:'south',border:false" style="text-align: right; padding: 5px 0;">
                <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="closeDialogLookCrack()">关闭窗口</a>
            </div>
        </div>
    </div>*@
